<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 100000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "<script language=\"JavaScript\">alert(\"错误，请联系管理员！\");</script>";
    }
  else
    {
   /* echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";*/

    if (file_exists("../css/images/" . $_FILES["file"]["name"]))
      {
      echo "<script language=\"JavaScript\">alert(\"文件已经存在，上传失败！\");</script>";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../css/images/" . $_FILES["file"]["name"]);
     echo "<script language=\"JavaScript\">alert(\"上传成功！\");</script>"; 
     
      }
    }
  }
else
  {
  	echo "<script language=\"JavaScript\">alert(\"文件格式不对或不满足文件大小限制！\");</script>";
  }
  
  echo "<script language='javascript'>window.location.href='winspics.php';</script>";
?>